<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>促销信息管理-添加</title>
<script src="js/jquery-1.8.0.min.js"></script>
<script src="js/jquery.easyui.min.js"></script>
<script src="js/wUpload.js"></script><!--重要-->
<link rel="stylesheet" type="text/css" href="js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="js/themes/icon.css">
<link rel="stylesheet" type="text/css" href="css/wUpload.css"><!--重要-->

<script>
//href = location.href;
//var reg = //;
//document.domain="localhost";
var pubB=false;

//保存
function dosave(){
	 $('#myForm').form('submit',{  
		 url:'<%=basePath%>/member/addConsumRecord.do',  
	     onSubmit:function(){  
	    	 var consumeMoney = $("#consumeMoney").val().length;
	    	 var consumeActual = $("#consumeActual").val().length;
	    	 var b = consumeMoney && consumeActual;
	    	 return b && $(this).form('validate'); 
	     },  
	     success:function(data){  
	         alert("添加成功"); 
	         parent.closeThis("#sellForm");
	         parent.GridReload("#List");
	     }  
	  });
}

////////////////////////////////////////////////////////////
////多文件上传

function uploadDialog(){
	$('#upload').show();
	$('#upload').dialog({  
		width:500,
		height:280,
	    modal:true
	});  
}

</script>
</head>

<body>

<form id="myForm" method="post">
<div class="F_Box" style="width:99.5%;height:350px;overflow:hidden">
	<div class="lineH20"></div>
	<div id="title" class="title">新增促销信息</div>
	<div class="lineH20"></div>
	<div class="content">
		<input type="hidden" id="optype" name="optype" value="add"/> 
		<input type="hidden" id="memberId" name="memberId" /> 
		<input type="hidden" id="ticketId" name="ticketId" /> 
		<div class="lineRect">
			<div class="label fl">活动开始日期：</div>
			<div class="textbox fl"><input id="consumeTime" type="text" name="consumeTime" class="easyui-datebox text" style="width:185px" data-options="required:true"/><span style="color:#CC0000"> *</span></div>
			
			<div class="textbox fr"><input id="consumeTime" type="text" name="consumeTime" class="easyui-datebox text" style="width:185px" data-options="required:true"/><span style="color:#CC0000"> *</span></div>
			<div class="label fr">活动结束日期：</div>
		</div>
		<div class="lineRect">
			<div class="label fl">促销标题：</div>
			<div class="bigtextbox fl"><input id='goods' type="text" name="goods" class="longtext"/></div>
		</div>		
		<div class="lineBox" style="height:80px;">
			<div class="label fl">促销活动描述：</div>
			<div class="bigtextbox fl"><textarea id='goods' name="goods" class="longtext" style="height:60px;"/></textarea></div>
		</div>
		<div class="lineRect">
			<div class="label fl">购买商品：</div>
			<div class="bigtextbox fl"><button type="button" onclick="uploadDialog()">上传图片</button></div>
		</div>
		<div class="fr"><input type="button" class="btn save" value="保存" onclick="dosave();"/></div><br/>
	</div>
	<div class="lineH20"></div></div><div style="height:15px;"></div>
	<div style="width:20px;" class="fr">&nbsp;</div>
			<!-- <div class="fr"><input type="button" class="btn" value="取消" onclick="alert$(parent.document.getElementById('sellForm')).dialog('close');"/></div> -->
		</div>
	</div>
</div>
</form>

<div id="win" title="会员卡信息" style="width:400px;height:0px;display:none"><!-- 会员信息 -->
	<div style="height:30px;margin-top:3px;">
	<div class="fr" style="margin-right:5px">输入手机号：<input type="text" value="" id="txt" style="width:100px;"/>&nbsp;<button class="btn" onclick="find('#txt')">搜索</button></div>
	</div>
	<table id="subList"></table>
	<div><button class="btn fr" style="margin-top:5px;margin-right:5px;" onclick="fun_closeWin()">确定</button></div> 
</div>  <!-- end win -->

<div id="win2" title="代金券明细" style="width:400px;height:0px;display:none"><!-- 会员信息 -->
	<div style="height:30px;margin-top:3px;">
	<div class="fr" style="margin-right:5px">输入搜索项：<input type="text" value="" id="txtNO" style="width:100px;"/>&nbsp;<button class="btn" onclick="find('#txtNO')">搜索</button></div>
	</div>
	<table id="subList2"></table>
	<div><button class="btn fr" style="margin-top:5px;margin-right:5px;" onclick="fun_closeWinNO()">确定</button></div> 
</div>  <!-- end win -->


<div id="upload" title="上传对话框" style="padding:5px;position:relative;display:none">
	<div id="uploadContent">

	</div>
</div>


</body>
</html>
<script>
function find(id){
	$("#subList").datagrid("load", {
		phone: $(id).val()
	});
}
function findNO(id){
	$("#subList2").datagrid("load", {
		phone: $(id).val()
	});
}
function getNow(type){
	var date = new Date();
	var y = date.getFullYear();
	var m = date.getMonth()+1;
	var d = date.getDate();
	var h = date.getHours();
	var mm = date.getMinutes();
	var s = date.getSeconds();
	m = FormatDate(m);
	d = FormatDate(d);
	h = FormatDate(h);
	mm = FormatDate(mm);
	s = FormatDate(s);

	if(type=="longdate")
	{
		return y + "-" + m +"-" +d + " " + h + ":" + mm +":" + s;
	}
	else if(type=="shortdate")
	{
		return y + "-" + m +"-" +d;
	}
}
function FormatDate(s)
{
	if(s.toString().length==1)
	{return "0" + s;}
	else{return s;}
}
//$("#registerTime").next().find("input").val(getNow());
$(function(){
	setTimeout(function(){
	$("#consumeTime").next().find("input").attr("value",getNow("consumeTime"));
	$("#registerTime").next().find("input").attr("value",getNow("longdate"));
	},100);
});

wFileBox.init("#uploadContent","upLoad.jsp","multi");

</script>
